function ajax(method, url, body, success, fail){
    let xhr = new XMLHttpRequest();
    xhr.onreadystatechange = () => {
        if(xhr.readyState == 4){
            if(xhr.status >= 200 && xhr.status < 300){
                success(xhr.responseText)
            }
            else{
                fail(xhr);
            }
        }
    }
    xhr.open(method, url);
    xhr.send(body);
}

